<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.lable.CaiGouSheZhi"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <style type="text/css">
    	.configDiv {
    		margin-top: 5px !important;
    		margin-bottom: 5px !important;
    		padding-top: 7px !important;
    		padding-bottom: 7px !important;
    		border-bottom: 1px solid #f4f4f4;
    	}
    	#tooltip{border:1px solid red; background:#FF6;
		position:absolute;
		padding:1px;
		color:#333;
		display:none;
		}
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.list.DingDanGuiZe"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#"><spring:message code="message.list.CaiGouGuiZe"/>查询</a></li>
            <li class="active"><a href="#"><spring:message code="message.list.DingDanGuiZe"/></a></li>
        </ol>
    </section>
    <section class="content">
	<form id="form" class="form-horizontal" action="savePurConfigList.html" method="post">
	    <div class="box box-success">
	    <div style="position: absolute;bottom:10px;right:10px;"><img src='${ctx }/lib/img/PurConfig.png'></div>
<!-- group1 -->

			<div style="width:100%;height:15px;"></div>
			<c:forEach items="${list}" var="list" varStatus="vs" >
					<div class="form-group form-group-xs" style="width:100%;height:30px;margin:0 0 0 30px;">
						<input id="config" name="config" type="hidden" value="${list.configId}" />
						<input id="configg" name="configg" type="hidden" value="${list.configValue}" />
						<input id="configvalue" name="configvalue" type="hidden" value="${list.configOpt}" />
						
                   		<div style="float:left;">
                   			<label>${ vs.index + 1}、</label>
                        	<label for="config" id="opt" >${list.configRemmarkOne}&nbsp;</label>
                        </div>
                        <div style="width:20px;float:left;">
                        <strong style="color:red">${list.configValue}</strong>
                        </div>
                        <div  style="float:left">
                        	<label for="config"  id="rem" >${list.configRemark}</label>
                       
                        </div>
                       <c:if test="${list.configPolitic != null }">
                        <div id="link" style="float:left;margin-left:5px;margin-top:-3px">
                        	<a style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -80px -100px' class='opIcon'  title='${list.configPolitic}'></a>
                        </div>
                        </c:if>
                        
                    </div>
                    
                    
                     
            </c:forEach>

 <!--<div style="margin-left:30px;">
  <i class="fa fa-exclamation-triangle" style="color:#dd4b39"></i> 
      <span>政策依据：</span>
  <br/>
  2015年度浙江省药品集中采购实施方案，医疗机构应加强药品采购、入库和使用的管理，按月发送药品订单，原则上，除急救药品外，基层医疗卫生机构每月发送采购计划一般不超过
</div>-->
        </div>
	</form>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    $(function(){
    	var x=0;
    	var y=0;
    	$("a.opIcon").mouseover(function(e){
    	this.myTitle=this.title;
    	this.title="";
    	var tooltip="<div id='tooltip'>"+this.myTitle+"</div>"; //创建DIV元素
    	$("#link").append(tooltip); //追加到文档中
    	$("#tooltip").css({"top": (e.pageY+y) + "px","left": (e.pageX+x) + "px"}).show();	//设置X Y坐标， 并且显示
    	}).mouseout(function(){
    	this.title=this.myTitle;
    	$("#tooltip").remove(); //移除
    	}).mousemove(function(e){
    	$("#tooltip").css({"top": (e.pageY+y) + "px","left": (e.pageX+x) + "px"});
    	})
    	});
    function saveConfig() {
        	if(!validata()){
        	   return;
        	}
    	  var params = [];
          $.each($("input[name='val']"), function(i,obj) {
        	  var configVal = $.trim($(obj).val());
        	  var configId = $.trim($(obj).attr("id"));
        	  params.push({"configId":configId,"configValue":configVal});
          });
          $.HN.message.confirm("<spring:message code="message.HN.alert.QueDingBaoCunMa"/>", '', '').on(function (e) {
	            if (e) {
          $.post("savePurConfigList.html", {
        	  "configs" : json.jsonToString(params)
          }, function(result) {
        	  if (result.success) {
                  top.$.alert("<spring:message code="message.HN.alert.BaoCunsuccess"/>", "success");
                  document.location="${ctx}/purConfig/toPurConfig.html";
              } else {
                  top.$.alert("<spring:message code="message.HN.alert.BaoCunFail"/>", "error");
              }
          }, "json");
	            }
			}); 
        }
    function validata(){
    	var number="";
       	number = document.getElementsByName("configvalue");
  	   var conn="";
  	   conn = document.getElementsByName("val");
  	   for(var n = 0;n < conn.length; n++) {
  		    if(conn[n] == null || conn[n].value  == ""){
  	     		$.HN.message.alert(number[n].value+"<spring:message code="message.HN.alert.QingZaiShuRuKuangZhongShuRuZhi"/>", "warn");
  	     		return false;
  	     	}else if(!/^\+?[1-9][0-9]*$/.test(conn[n].value)){
  	     		$.HN.message.alert(number[n].value+"<spring:message code="message.HN.alert.QingShuRuDaYuLingDeShu"/>", "warn");
  	     		return;
  	     	}
  		} 
   
   	
       	return true;
       }
    
    
       
    </script>
</body>
</html>
